/**
 * 
 */
package com.great.meal.search.domain;

import java.io.Serializable;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 * 点餐人员信息
 * 
 * @author lenovo
 * 
 */
@NamedQueries({
	@NamedQuery(name = "customer.findByAccount",
		query = "from Customer c where c.account = ? ")
})

@Entity
@Table(name = "t_customer")
public class Customer implements Serializable {

	private static final long serialVersionUID = 5643541148457322044L;

	private Long customerId;
	private String customerName;
	private String account;
	private String customerPwd;
	private String mailAccount;
	private Integer credibility; // 默认在100[0-100]
	private Integer consumption;
	private String contactInfo;
	private Boolean useable; // true 表示可用,false不可用.默认为false.

	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	public Long getCustomerId() {
		return customerId;
	}

	public void setCustomerId(Long customerId) {
		this.customerId = customerId;
	}

	public String getCustomerName() {
		return customerName;
	}

	public void setCustomerName(String customerName) {
		this.customerName = customerName;
	}

	public String getAccount() {
		return account;
	}

	public void setAccount(String account) {
		this.account = account;
	}

	public String getCustomerPwd() {
		return customerPwd;
	}

	public void setCustomerPwd(String customerPwd) {
		this.customerPwd = customerPwd;
	}

	public String getMailAccount() {
		return mailAccount;
	}

	public void setMailAccount(String mailAccount) {
		this.mailAccount = mailAccount;
	}

	public Integer getCredibility() {
		return credibility;
	}

	public void setCredibility(Integer credibility) {
		this.credibility = credibility;
	}

	public Integer getConsumption() {
		return consumption;
	}

	public void setConsumption(Integer consumption) {
		this.consumption = consumption;
	}

	public String getContactInfo() {
		return contactInfo;
	}

	public void setContactInfo(String contactInfo) {
		this.contactInfo = contactInfo;
	}

	public Boolean isUseable() {
		return useable;
	}

	public void setUseable(Boolean status) {
		this.useable = status;
	}

	@Override
	public int hashCode(){
		int result = customerId != null ? customerId.hashCode() : 0;
		result = 31 * result + (customerName != null ? customerName.hashCode() : 0);
		result = 31 * result + (account != null ? account.hashCode() : 0);
		result = 31 * result + (mailAccount != null ? mailAccount.hashCode() : 0);
		result = 31 * result + (credibility != null ? credibility.hashCode() : 0);
		result = 31 * result + (consumption != null ? consumption.hashCode() : 0);
		result = 31 * result + (contactInfo != null ? contactInfo.hashCode() : 0);
		result = 31 * result + (useable != null ? useable.hashCode() : 0);
		
		return result;
	}
	
	@Override
	public boolean equals(Object other){
		if (this == other)  return true;
		if (!(other instanceof Customer)) return false;

		final Customer customer = (Customer) other;

		if (!customer.getCustomerId().equals(getCustomerId()))  return false;
		if (!customer.getCustomerName().equals(getCustomerId()))  return false;
		if (!customer.getAccount().equals(getAccount()))  return false;
		if (!customer.getMailAccount().equals(getMailAccount()))  return false;
		if (!customer.getCredibility().equals(getCredibility()))  return false;
		if (!customer.getConsumption().equals(getConsumption()))  return false;
		if (!customer.getContactInfo().equals(getContactInfo()))  return false;
		if (!customer.isUseable().equals(isUseable()))  return false;
		
		return true;
		
	}
}
